package q3;

//import java.util.Arrays;
import java.util.Random;

import genetic.Genotype;

public class cliqueGenotype implements Genotype{

	public boolean[] instance;
	public Random rand;
	public int _size;
	public int _max;
	
	public cliqueGenotype(){
		
	}

	public cliqueGenotype(int size, int max){
		rand = new Random();
		_size = size;
		_max = max;
		instance = new boolean[_size];
		double Pm = ((double)max/(double)size)/10;
		for(int i=0; i<_size; i++){
			double m = rand.nextDouble();
			if(m < Pm)
				instance[i]= true;
			else instance[i]= false;
		}
//		String ans = "";
//		for (int i=0; i<_size; i++){
//			if(instance[i])
//				ans = ans+"1";
//			else ans = ans+"0";
//		}
//		System.out.println(ans+"\t"+Pm);
	}
	
	public cliqueGenotype clone(){
		return new cliqueGenotype(_size, _max);
	}

	@Override
	public String toString() {
		String ans = "";
		for (int i=0; i<_size; i++){
			if(instance[i])
				ans = ans+"1";
			else ans = ans+"0";
		}
		return ans;
	}

}
